From e0ac533c0d8711fbe2fa8360c66393f1cae468d6 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 15 Jan 2008 11:29:15 +0000 Subject: [PATCH] x86: INT3 and INTO trap gates should have DPL==3. This was broken by c/s 16667 (gdbstub changes). Signed-off-by: Keir Fraser --- xen/arch/x86/traps.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 9e7ade8c90..25fa48623f 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -2679,14 +2679,24 @@ asmlinkage void do_spurious_interrupt_bug(struct cpu_user_regs *regs) { } -void set_intr_gate(unsigned int n, void *addr) +static void __set_intr_gate(unsigned int n, uint32_t dpl, void *addr) { int i; /* Keep secondary tables in sync with IRQ updates. */ for ( i = 1; i < NR_CPUS; i++ ) if ( idt_tables[i] != NULL ) - _set_gate(&idt_tables[i][n], 14, 0, addr); - _set_gate(&idt_table[n], 14, 0, addr); + _set_gate(&idt_tables[i][n], 14, dpl, addr); + _set_gate(&idt_table[n], 14, dpl, addr); +} + +static void set_swint_gate(unsigned int n, void *addr) +{ + __set_intr_gate(n, 3, addr); +} + +void set_intr_gate(unsigned int n, void *addr) +{ + __set_intr_gate(n, 0, addr); } void set_tss_desc(unsigned int n, void *addr) @@ -2753,8 +2763,8 @@ void __init trap_init(void) set_intr_gate(TRAP_divide_error,÷_error); set_intr_gate(TRAP_debug,&debug); set_intr_gate(TRAP_nmi,&nmi); - set_intr_gate(TRAP_int3,&int3); /* usable from all privileges */ - set_intr_gate(TRAP_overflow,&overflow); /* usable from all privileges */ + set_swint_gate(TRAP_int3,&int3); /* usable from all privileges */ + set_swint_gate(TRAP_overflow,&overflow); /* usable from all privileges */ set_intr_gate(TRAP_bounds,&bounds); set_intr_gate(TRAP_invalid_op,&invalid_op); set_intr_gate(TRAP_no_device,&device_not_available); -- 2.30.2